pp.create.create_transformers value initialization not working#2894
pp.create.create_transformers value initialization not working#2894belobradi wants to merge 6 commits intoe2nIEE:developfrom
Conversation
belobradi
commented
Feb 28, 2026
- create_transformers now forwards tap and optional std-type params.
- updated tests verifying these fields.
…E#2886) * create_transformers now forwards tap and optional std-type params. * updated tests verifying these fields.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2894 +/- ##
========================================
Coverage 72.26% 72.26%
========================================
Files 351 351
Lines 37967 37968 +1
========================================
+ Hits 27438 27439 +1
Misses 10529 10529 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…E#2886) * Remove unnecessary shift_degree extraction. * Remove redundant tap_changer_type value check. * Pass std_params directly to params dict instead of extracting individually. * test_create should use tolist() instead of "value". * npt.NDArray should use "integer" as a numpy.
…E#2886) * Remove redundant tap_changer_type value check reverted. * UT added for std_type override when create_transformers is used.
| params = {**std_params, **kwargs} | ||
|
|
||
| if tap_changer_type is not None: | ||
| params["tap_changer_type"] = tap_changer_type |
There was a problem hiding this comment.
While I think this change is a good Idea there seems to be one issue.
If the standard type includes one of the explicitly passed parameters this will fail.
Standard types in pandapower have a set of minimal required values that need to be set, but can take any additional values.
So I could create a standard_type that includes e.g a derating factor df, with you're code change this would lead to df being passed twice as a keyword and lead to a TypeError: pandapower.create.trafo_create.create_transformers_from_parameters() got multiple values for keyword argument 'df'
Reproducible example:
from pandapower.std_types import create_std_type, load_std_type
from pandapower.networks.mv_oberrhein import mv_oberrhein
from pandapower.create.trafo_create import create_transformers
net = mv_oberrhein()
std_params = load_std_type(net, "63 MVA 110/10 kV", "trafo")
create_std_type(net, {**std_params, "df": .8}, "MyTrafoType", "trafo")
create_transformers(net, [58], [0], "MyTrafoType")
print(net)| assert net.trafo["in_service"].tolist() == [True] | ||
| assert net.trafo["oltc"].tolist() == [False] | ||
| assert net.trafo["test_kwargs"].tolist() == ["TestKW"] | ||
| assert net.trafo["vector_group"].tolist() == ["Dyn5"] |
There was a problem hiding this comment.
This change seems to be unrelated to the PR.
I would also not approve of it as this seems overly complex, if the original assert fails you can get slightly better output if you have CLI logging enabled while testing.
Same for the test above.
|


